home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / CmdExtns.pxl < prev    next >
Text File  |  2001-10-04  |  7KB  |  237 lines

  1. {    Filename    :     CmdExtns.pxl
  2.      Purpose    :    Show how thr Extension commands work.
  3.     Date        :    04 October, 2001
  4.     Author        :    Stewart DIBBS, VYSOR
  5. History:
  6.  
  7.     Version    :      5.1    RELEASE
  8.     Update        :  
  9.     Date        :  
  10.  
  11. --------------------------------------------------------------------------}
  12. Initialize: {only one instance allowed}
  13.     UseCoordinates(PIXEL)
  14.     Title$ = "PiXCL Extension Commands"                                  
  15.     WinExist(Title$,Res)
  16.     If Res = 0 Then Goto One_Instance
  17.     Beep
  18.     WinSetActive(Title$,Res)
  19.     WinShow(Title$,RESTORE,Res)
  20.     End
  21. One_Instance:
  22.     
  23.     UseCaption(Title$) {change the title}
  24.     WinLocate(Title$,238,96,860,520,Res)                
  25.     UseBackground(TRANSPARENT,0,128,192)     
  26.     WinShow(Title$,NOTOPMOST,Res) 
  27.     DrawBackGround
  28.     DirGet(SourceDir$) {used later for library function calls}
  29.     
  30.     DragAcceptFile(ENABLE,AcceptFile)
  31.     AutoProgressBar(DISABLE)
  32.  
  33.     InfoMenu(REMOVE)
  34.     WaitInput(100)
  35.     SetMenu("&File",IGNORE,
  36.         "&New",CreatingFile,
  37.         "&Open",OpeningFile,
  38.         "&Save",SavingFile,
  39.         SEPARATOR,
  40.         "E&xit!",Terminate,
  41.         ENDPOPUP,
  42.         "&View",IGNORE,
  43.         "&ToolBar",ViewToolBar,
  44.         "&StatusBar",ViewStatusBar,
  45.         ENDPOPUP,
  46.         "&Information",IGNORE,
  47.         "&Concept",Concept,
  48.         "&Help",ShowAppHelp,
  49.         SEPARATOR,
  50.         "&About",About,
  51.         ENDPOPUP)
  52.     
  53.     GoSub MakeToolbar
  54.     ChangeMenuItem("&ToolBar",CHECK,TBRes)
  55.  
  56.         
  57.     StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  58.     DrawStatusWinText(0,"Ready")
  59.     ChangeMenuItem("&StatusBar",CHECK,SBRes)
  60.  
  61.         
  62.     
  63.     
  64. Wait_for_Input:
  65.     WaitInput()
  66.  
  67. Terminate:
  68.     End
  69.  
  70.  
  71. Concept:
  72.     MessageBox(OK,1,INFORMATION,
  73. "This is a skeleton of a PiXCL application.  You could briefly
  74. describe your application's function here, or provide some
  75. basic help information.",
  76.     "PiXCL Skeleton Concept",Res)
  77.  
  78.     Goto Wait_for_Input
  79.  
  80. ShowAppHelp:
  81.     {An application Help file usually has the same name as the application.}
  82.     Winhelp("CmdExtns.hlp",CONTENTS,"")
  83.  
  84.     Goto Wait_for_Input
  85.  
  86. About:
  87.     AboutUser(Title$, 
  88.       "Two lines of text goes here e.g. Application function.",
  89.     "Four Lines of additional information goes here, perhaps contact information and Web addresses")   
  90.  
  91.     Goto Wait_for_Input
  92.  
  93. ViewToolBar:
  94.     GetMenuStatus("&ToolBar",CHECKED,Res)
  95.     If Res = 0
  96.         GoSub MakeToolbar
  97.         ChangeMenuItem("&ToolBar",CHECK,Res)
  98.     Else
  99.         Toolbar()
  100.         ChangeMenuItem("&ToolBar",UNCHECK,Res)
  101.     Endif
  102.     Goto Wait_for_Input
  103.  
  104. ViewStatusBar:
  105.     GetMenuStatus("&StatusBar",CHECKED, Res)
  106.     If Res = 0
  107.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  108.         DrawStatusWinText(0,"Ready")
  109.         ChangeMenuItem("&StatusBar",CHECK,Res)
  110.     Else
  111.         StatusWindow(DISABLE,BOTTOM,2,200,-1,0,0)
  112.        ChangeMenuItem("&StatusBar",UNCHECK,Res)
  113.     Endif
  114.     Goto Wait_for_Input
  115.  
  116. CreatingFile:
  117.     WaitInput(1)
  118.     FreeVar(Folder$)
  119.     GetSpecialFolder("Locate Network Information",NETWORK,BROWSEINCLUDEFILES,Folder$)
  120.     DebugMsgBox(Folder$)
  121.  
  122.     Goto Wait_for_Input
  123.  
  124. OpeningFile:
  125.     WaitInput(1)
  126.     Search$ = SourceDir$ + "\*.pxl"
  127.     FileExist(Search$,Res)
  128.     DebugMsgBox(Res)
  129.  
  130.     DirListFiles(Search$,"|",Number,List$)
  131.     DebugMsgBox(Number)
  132.     DebugMsgBox(List$)
  133.     Goto Wait_for_Input
  134.  
  135. SavingFile:
  136.     WaitInput(1)
  137.     DrawBackground
  138.     UseFont("Arial",13,27,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  139.     DrawShadowText(20,40,"An Extension Command API is available",255,255,255,1)
  140.     UseFont("Arial",9,19,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  141.  
  142.     UserDLL$ = "PXLucmds.dll" 
  143.  
  144.  
  145.     GeoPIXCLDLLABout(UserDLL$,Res)
  146.  
  147.  
  148.     RegisterUserCommand(UserDLL$,"gpxUser_1",Res,  P_STRING,   P_NUMBER, 
  149.                   P_FP_NUMBER, P_FP_VARIABLE, P_NUM_VARIABLE)
  150.     If Res = 2 Then DebugMsgBox("User Command#1 OK,1  arg, already registered") 
  151.  
  152.     RegisterUserCommand(UserDLL$,"gpxUser_2",Res, P_STRING, P_NUM_VARIABLE,
  153.                   P_COORDINATE, P_RGB, P_NUM_VARIABLE)
  154.     If Res = 2 Then DebugMsgBox("User Command#2 OK, multiple args, already registered") 
  155.  
  156.     RegisterUserCommand(UserDLL$,"gpxUser_3",Res,  P_STRING,
  157.                    P_NUMBER, P_NUM_VARIABLE)
  158.  
  159.     DrawText(20,70,"1: Set initial values and do an FP calculation in a DLL")
  160.                Mux& = 13.7885 {set an inital value}
  161.     gpxUser_1("string",10, 2.334, Mux&, Res) 
  162.     If Res = -1 Then DebugMsgBox("Can't find the command in the User DLL") 
  163.     DebugMsgBox(Mux&)
  164.  
  165.     DrawText(20,90,"2: Set initial values and do a integer calculation in a DLL.")
  166.     gpxUser_2("string",FnNumber, 12,12, 1,2,3,  Res) 
  167.     If Res = -1 Then DebugMsgBox("Can't find the command in the User DLL") 
  168.     DebugMsgBox(FnNumber) {should be 137}
  169.  
  170.     DrawText(20,110,"3: Pass a string into a DLL, display custom dialogs.")
  171.     gpxUser_3("string",10,Res) 
  172.  
  173.  
  174.     DrawText(20,130,"4: Display a common dialog in a DLL and return a filename")
  175.     RegisterUserCommand(UserDLL$,"gpxUser_4",Res,  P_STR_VARIABLE, 
  176.                 P_NUM_VARIABLE)
  177.      OpenFileInDLL$ = "Test"
  178.     gpxUser_4 (OpenFileInDLL$,Res) 
  179.     DebugMsgBox(OpenFileInDLL$)
  180.  
  181.  
  182.     DrawText(20,150,"5: Access other geoPiXCL DLLs, if installed.")
  183.     RegisterUserCommand(UserDLL$,"gpxUser_5",Res, P_COORDINATE, P_NUM_VARIABLE)
  184.     gpxUser_5 (-100,100,Res) 
  185.  
  186.  
  187.     DrawText(20,170,"6: Display more custom dialogs within a DLL.")
  188.     RegisterUserCommand(UserDLL$,"gpxUser_6",Res, P_COORDINATE,P_NUM_VARIABLE)
  189.     gpxUser_6 (-100,100,Res) 
  190.  
  191.     UseFont("Arial",13,27,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  192.     DrawShadowText(20,200,"The Extension Command API costs C$350",255,255,255,1)
  193.     UseFont("Arial",9,19,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  194.     DrawText(40,240,"Applicable provincial taxes and GST are extra.")
  195.     DrawText(40,260,"Please contact VYSOR Integration directly. We take VISA.")
  196.  
  197.     UnregisterUserCmds(Count)
  198.     Goto Wait_for_Input
  199.  
  200. GradientFiller:
  201.     WaitInput(1)
  202.     DrawBackground
  203.     DrawShadeRectangle(80,80,200,320, 0,0,0, 0,0,224, BOTTOMTOP)
  204.     GradientFillRect(220,80,420,320,HORZ, 0,0,0, 0,0,224)
  205.     
  206.     Goto Wait_for_Input
  207.  
  208.  
  209.  
  210. PrintingFile:
  211.     WaitInput(1)
  212.     {TODO: add file handling here}
  213.     MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
  214.                     "Printing File",Res)
  215.     Goto Wait_for_Input
  216.  
  217. AcceptFile:
  218.     GetDragList(FileList$)
  219.     {TODO: add file list handling here, or delete this whole label handler}
  220.     Goto Wait_for_Input
  221.     
  222. {--- Style Suggestion: place all subroutines at the end of the script.}
  223.  
  224. MakeToolbar: {subroutine}
  225.     Toolbar(    FLAT, PXL_LARGE,
  226.         NULL, NULL, SEPARATOR, "", Wait_for_Input, 
  227.         PXL_NEW, ENABLED, STD, "GetSpecialFolder Test", CreatingFile,
  228.         PXL_OPEN, ENABLED, STD, "DirListFiles Test", OpeningFile, 
  229.         PXL_SAVE, ENABLED, STD, "Show Extension Commands", SavingFile,
  230.         PXL_PRINT,  ENABLED, STD,"PrintFile", PrintingFile, 
  231.         FLOOD,  ENABLED, STD,"Gradient Filling",GradientFiller,
  232.         NULL, NULL, SEPARATOR, "", Wait_for_Input, 
  233.         HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp,
  234.         NULL, NULL, SEPARATOR, "", Wait_for_Input)
  235.  
  236.     Return
  237.